package com.lj.sys.param;

import com.lj.sys.entity.SysConfig;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import com.lj.sys.enums.SysConfigCategory;
import com.lj.common.utils.EnumUtils;

/**
 * <p>
 * 系统配置表 更新参数
 * </p>
 *
 * @author luojing
 * @since 2025-02-21 14:11:02
 */
@Data
@Schema(description = "系统配置表 更新参数")
public class SysConfigUpdateParam {

    @Schema(description = "主键id")
    private Long id;

    @Schema(description = "配置key")
    private String configKey;

    @Schema(description = "配置值")
    private String configValue;

    @Schema(description = "分类 参考字典: SysConfigCategory")
    private Integer category;

    @Schema(description = "备注")
    private String remark;

    public SysConfig toEntity() {
        SysConfig entity = new SysConfig();
        entity.setId(id);
        entity.setConfigKey(configKey);
        entity.setConfigValue(configValue);
        entity.setCategory(EnumUtils.getByValue(SysConfigCategory.class, category));
        entity.setRemark(remark);
        return entity;
    }
}
